rm(list = ls())
library(data.table)
library(plyr)
library(tidyr)
library(lfe)
library(stargazer)
library(xtable)
library(sandwich)
library(roll)
library(readxl)
library(readr)
library(zoo)
library(texreg)
library(DescTools)
library(ggplot2)

m <- data.table(read_xlsx("../Data/MasterData.xlsx", skip = 1, guess_max = 1e4))
C <- data.table(read_xlsx("../Data/AccountData.xlsx", guess_max = 1e4))

# Main sample
nrow(m)

sample.neutral <- m[type == 0]
sample.happy <- m[type == 1]
sample.pain <- m[type == 2]
# Treatment Neutral, Happy, Painful
c(
  nrow(sample.neutral),
  nrow(sample.happy),
  nrow(sample.pain)
)

# Merged sample
m1 <- merge(m, C, by = "id")
nrow(m1)
